<?php

/**
 * Proveedor form base class.
 *
 * @method Proveedor getObject() Returns the current form's model object
 *
 * @package    SAC_CLonsa
 * @subpackage form
 * @author     Your name here
 */
abstract class BaseProveedorForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'        => new sfWidgetFormInputHidden(),
      'nombre'    => new sfWidgetFormInputText(),
      'direccion' => new sfWidgetFormInputText(),
      'fono'      => new sfWidgetFormInputText(),
      'sugerido'  => new sfWidgetFormInputText(),
      'rut'       => new sfWidgetFormInputHidden(),
    ));

    $this->setValidators(array(
      'id'        => new sfValidatorPropelChoice(array('model' => 'Proveedor', 'column' => 'id', 'required' => false)),
      'nombre'    => new sfValidatorString(array('max_length' => 30)),
      'direccion' => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'fono'      => new sfValidatorString(array('max_length' => 13, 'required' => false)),
      'sugerido'  => new sfValidatorInteger(array('min' => -128, 'max' => 127)),
      'rut'       => new sfValidatorPropelChoice(array('model' => 'Proveedor', 'column' => 'rut', 'required' => false)),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorPropelUnique(array('model' => 'Proveedor', 'column' => array('nombre')))
    );

    $this->widgetSchema->setNameFormat('proveedor[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Proveedor';
  }


}
